package pers.cj.pdos.mapper;

import org.apache.ibatis.annotations.Param;
import pers.cj.pdos.entity.Goods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import pers.cj.pdos.vo.CountVo;
import pers.cj.pdos.vo.GoodsVo;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author chenj
 * @since 2019-11-04
 */
public interface GoodsMapper extends BaseMapper<Goods> {
    List<GoodsVo> listVoForCheckHouse(@Param("companyId")String companyId,
                                  @Param("page") Integer page,
                                  @Param("limit") Integer limit,
                                  @Param("status") Integer status,
                                  @Param("search") String search,
                                  @Param("typeId") String typeId,
                                  @Param("no")String no,
                                  @Param("name")String name,
                                  @Param("attr")String attr,
                                  @Param("norms")String norms,
                                  @Param("remark")String remark,
                                  @Param("sn")Boolean sn,
                                  @Param("houseId")String houseId);

    List<GoodsVo> listVoWithStock(@Param("companyId")String companyId,
                         @Param("page") Integer page,
                         @Param("limit") Integer limit,
                         @Param("status") Integer status,
                         @Param("search") String search,
                         @Param("typeId") String typeId,
                         @Param("no")String no,
                         @Param("name")String name,
                         @Param("attr")String attr,
                         @Param("norms")String norms,
                         @Param("remark")String remark,
                         @Param("sn")Boolean sn,
                         @Param("houseId")String houseId);

    List<GoodsVo> listVoForInit(@Param("companyId")String companyId,
                                @Param("page") Integer page,
                                @Param("limit") Integer limit,
                                @Param("search") String search,
                                @Param("storeId")String storeId,
                                @Param("houseId")String houseId);
    Long countForInit(@Param("companyId")String companyId,
                      @Param("search") String search,
                      @Param("storeId")String storeId,
                      @Param("houseId")String houseId);

    List<GoodsVo> listVo(@Param("companyId")String companyId,
                         @Param("page") Integer page,
                         @Param("limit") Integer limit,
                         @Param("status") Integer status,
                         @Param("search") String search,
                         @Param("typeId") String typeId,
                         @Param("no")String no,
                         @Param("name")String name,
                         @Param("attr")String attr,
                         @Param("norms")String norms,
                         @Param("remark")String remark,
                         @Param("sn")Boolean sn);
    Long count(@Param("companyId")String companyId,
               @Param("status") Integer status,
               @Param("search") String search,
               @Param("typeId") String typeId,
               @Param("no")String no,
               @Param("name")String name,
               @Param("attr")String attr,
               @Param("norms")String norms,
               @Param("remark")String remark,
               @Param("sn")Boolean sn);

    List<GoodsVo> listVoByIds(@Param("list")List<String> ids);
    GoodsVo getVoById(@Param("id")String id);
    List<Long> check(String id);

    List<CountVo> checkList(List<Goods> list);

    void insertBatch(List<Goods> goodsList);

    /**
     * 批量开启sn
     * @param list
     */
    void batchOpenSn(List<Goods> list);

    /**
     * 批量修改状态
     * @param list
     * @param status 1-开启 2-停用
     */
    void batchStatus(@Param("list")List<Goods> list, @Param("status")Integer status);

    /**
     * 批量移动至分类
     * @param list
     * @param typeId
     */
    void batchMoveType(@Param("list") List<Goods> list, @Param("typeId") String typeId);

    /**
     * 批量删除
     * @param list
     */
    void batchDelete(@Param("list") List<Goods> list);

    GoodsVo getVoByCode(@Param("code") String code, @Param("companyId")String companyId);

    Long checkCodeListBeUsed(@Param("companyId") String companyId, @Param("id") String id, @Param("list") List<String> list);
}
